<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script>
				
					// 1. 对象
					
					// js基于对象
					// 如果要创建对象 new Object()
					
					// 方式1
					var stu1 = new Object();
					stu1.name = "张三";
					stu1.age = 18;
					console.log(stu1.name);
					console.log(stu1.age);
					
					console.log(typeof stu1);
					
					// 方式2 (简化写法)
					var stu2 = {
						name:"李四",
						age:18
					};
					
					
					var stu3 = {
						name:"李四",
						age:18,
						friends:["张三","刘备","孙权"],
						dog:{
							name:"小白",
							age:2,
							type:"哈巴狗"
						}
					}
					
					
					// 2 数组
					var names = new Array("张三","李四","王五");
					console.log(names[0]);
					var names = ["张三","李四","王五"]
					
					// 3. 函数
					
					// 方式1
					function foo1(a,b)
					{
						c = a+b;
						return c;
					}
					console.log(foo1(100,300));
					
					// 方式2
					var foo2 = function(a,b)
					{
						return a+b;
					}
					console.log(foo2(100,300));
					
					// 4. 日期
					var now = new Date();
					console.log(now);
					
					// 5.数学函数
					var n = Math.random();
					console.log(n);
					
					
					
				
				</script>
	</body>
</html>
